package com.zhouliang.login.commom;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.zhouliang.error.StatusCode;
import com.zhouliang.util.CommonResponse;

@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class RegisterResponse extends CommonResponse {
    public Long userId;
    public String token;

    private RegisterResponse(StatusCode statusCode, Long userId, String token) {
        this.statusCode = statusCode.getCode();
        this.statusMsg = statusCode.getMsg();
        this.userId = userId;
        this.token = token;
    }

    public static RegisterResponse ok(StatusCode statusCode, Long userId, String token) {
        return new RegisterResponse(statusCode, userId, token);
    }

    public static RegisterResponse fail(StatusCode statusCode) {
        return new RegisterResponse(statusCode, null, null);
    }
}
